package org.myhomework.servelet;

import org.myhomework.dao.TeacherDao;
import org.myhomework.entity.Teacher;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class DeleteTeacherServlet extends HttpServlet {

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        TeacherDao.deleteById(Integer.valueOf(req.getParameter("id")));
        req.setAttribute("back", req.getParameter("back"));
        req.setAttribute("msg", "删除成功");
        req.getRequestDispatcher("/ok.jsp").forward(req, resp);
    }
}
